

OBJ=obj
SRC=src
EXE=bin
CPPFLAGS=-c -g
CXX=g++
LDFLAG=-std=c++11 -L./ -lothers1

SRCFILES=
OBJFILES=$(OBJ)/calcTrailingZeros.o \
         $(OBJ)/calcMax.o \
         $(OBJ)/calcHit.o \
         $(OBJ)/printWords.o \
         $(OBJ)/numNames.o \
         $(OBJ)/maxSubArray.o \
         $(OBJ)/wordFreq.o \
         $(OBJ)/findIntPair.o \
         $(OBJ)/palindromeString.o \
         $(OBJ)/firstMissingPositive.o \
         $(OBJ)/trap.o

all: others1.dll \
     testCalcTrailingZeros.exe \
     testMax.exe \
     testPrintWords.exe \
     testMaxSubArray.exe \
     testWordFreq.exe \
     testRand.exe \
     testFindIntPair.exe \
     testPalindrome.exe \
     testFirstMissPositive.exe \
     testTrap.exe \
     install

$(OBJ)/%.o : $(SRC)/%.cpp
	$(CXX) $(CPPFLAGS) -o $@ $<

others1.dll : $(OBJFILES)
	$(CXX) -shared -o $@ $^

testCalcTrailingZeros.exe : $(OBJ)/testCalcTrailingZeros.o
	$(CXX) $(LDFLAG) -o $@ $^

testMax.exe : $(OBJ)/testMax.o
	$(CXX) $(LDFLAG) -o $@ $^

testPrintWords.exe : $(OBJ)/testPrintWords.o
	$(CXX) $(LDFLAG) -o $@ $^

testMaxSubArray.exe : $(OBJ)/testMaxSubArray.o 
	$(CXX) $(LDFLAG) -o $@ $^

testWordFreq.exe : $(OBJ)/testWordFreq.o 
	$(CXX) $(LDFLAG) -o $@ $^

testRand.exe : $(OBJ)/testRand.o 
	$(CXX) $(LDFLAG) -o $@ $^

testFindIntPair.exe : $(OBJ)/testFindIntPair.o 
	$(CXX) $(LDFLAG) -o $@ $^

testPalindrome.exe : $(OBJ)/testPalindrome.o 
	$(CXX) $(LDFLAG) -o $@ $^

testFirstMissPositive.exe : $(OBJ)/testFirstMissPositive.o 
	$(CXX) $(LDFLAG) -o $@ $^

testTrap.exe : $(OBJ)/testTrap.o 
	$(CXX) $(LDFLAG) -o $@ $^

install:
	mv *.exe $(EXE)/.
	mv *.dll $(EXE)/.
   

clean:
	rm -rf 	$(OBJ)/*.o $(EXE)/*.exe $(EXE)/*.dll
